package com.cci.kangdao.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

@MapperScan
public interface MemberDao {

	@Select("select count(*) from Member_T where UserId = #{userId} and Flag = 0")
	int getIsDYMemberByUserId(@Param("userId") long userId);

	@Select("select count(1) from VIP_VehicleUser_T where UserId = #{userId} and left(ExpirationTime,10) >= #{date} and VIPType in (1,5,7) and Flag = 0")
	int getIsVipByUserId(@Param("userId") long userId,@Param("date") String date);

	@Select("select count(1) from VIP_VehicleUser_T vvut left join CustomerEngineRel_T cert on cert.UserId = vvut.UserId and vvut.ESN = cert.ESN  where vvut.UserId = #{userId} and left(vvut.ExpirationTime,10) >= #{date} and vvut.VIPType in (1,5,7) and vvut.Flag = 0 and cert.Flag = 0")
	int getIsVipAndEsnByUserId(@Param("userId") long userId,@Param("date") String date);
}
